#include "struct.h"

ItemInfo newItemInfo(string name, int color, string category)
{
    ItemInfo info;
    info.name = name;
    info.color = color;
    info.category = category;
    return info;
}

void ItemInfo::Tag_To_Info(string taget, ItemInfo newitm)
{
    if (this->Ptr && m_CachedPtr(this->Ptr) && Object_IsNativeObjectAlive(this->Ptr))
    {
        auto str = Object_get_name(this->Ptr);
        if(str)
        {
            auto name = str->ToString();
            if (name == taget)
            {
                this->name = newitm.name;
                this->color = newitm.color;
                this->category = newitm.category;
            }
        }
    }
}